package Error;

public class LogIn {
    private String name="aaa";
    private String password="123";

    public  void login(String name,String password) {
        if (!this.name.equals(name)){
            throw new NameErrorException("用户名错误");
        }
        if (!this.password.equals(password)){
            System.out.println("密码错误");
            return ;
        }
        System.out.println("登陆成功");
    }


    public static void main(String[] args) {
        LogIn logIn=new LogIn();
        try{
            logIn.login("aa","123");
        }catch(NameErrorException e){
            e.printStackTrace();
        }
        System.out.println("jixu");


    }
}
